<!DOCTYPE html 
<html xmlns="https://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>中午吃什么</title> 
<style type="text/css">
	img{
		width: 10%;
		margin-left: 12%;
	}
</style>
<script type="text/javascript"> 
var names=new Array("饼干","这么胖你还吃？","鸡排饭","这么胖你还吃？","不吃饭","喝水","这么胖你还吃？","面条","这么胖你还吃？","猪排饭","这么胖你还吃？","亚惠","这么胖你还吃？","麻辣拌","这么胖你还吃？","吃个面包吧","这么胖你还吃？","手抓饼","这么胖你还吃？","烤冷面","这么胖你还吃？"); 
function showName(){ 
    var index = Math.floor(Math.random()*names.length); 
    var name = names[index]; 
    document.getElementById("showView").innerHTML = name; 
    idd=setTimeout("showName()",21); 
} 
var state = true; 
var idd; 
function sssss(){ 
    if(state){ 
        showName(); 
        state = false; 
    } 
    else{ 
        clearTimeout(idd); 
        state = true; 
    } 
         
} 
 
 
</script> 
</head> 
 
<body> 
<p id="showView" style="width:400px; height:100px; font-size:40px; color:red;margin-left: 41%;margin-top: 5%;text-align: center;"></p> 
<input type="button" onclick="sssss()" value="点我！我就告诉你！" style="margin-left: 48%;margin-top: 5%;"/> 
<div style="width: 100%;height: 300px;margin-top: 5%;">
	<img src="img/1.jpg"/>
	<img src="img/2.jpg"/>
	<img src="img/3.jpg"/>
	<img src="img/4.jpg"/>
</div>
</body> 
</html> 